﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using DevFX.DataAccess.DTO;
using System.Web.Security;

namespace DevFX.DataAccess
{
    public class MembershipDataProvider : IDataProvider
    {
        #region IDataProvider 成员

        public User[] GetUsers()
        {
            //return Membership.GetAllUsers().OfType<MembershipUser>().Select(mu => this.GetUserForMembershipUser(mu)).ToArray();

            return new User[] { new User(){ UserName="1", Nickname="1", Password="1", Email="1", Question="1", Answer="1"},
            new User(){ UserName="2", Nickname="2", Password="2", Email="2", Question="2", Answer="2"},
            new User(){ UserName="3", Nickname="3", Password="3", Email="3", Question="3", Answer="3"},};
        }

        #endregion

        private User GetUserForMembershipUser(MembershipUser membershipUser)
        {
            User user = new User();
            user.UserName = membershipUser.UserName;
            user.Nickname = "";
            user.Password = "";
            user.Email = membershipUser.Email;
            user.Question = membershipUser.PasswordQuestion;
            user.Answer = "";

            return user;
        }

    }
}
